import 'package:flutter/material.dart';
import 'package:hotpot/widgets/widget_ext.dart';

import '../z_container.dart';

class NumPoint extends StatelessWidget {
  final int num;
  final int max;
  final Color color;
  final Color textColor;
  final double minSize;
  final double textSize;
  final bool zeroShow;

  const NumPoint(
    this.num, {
    super.key,
    this.max = 99,
    this.color = const Color(0xFFEEF2FE),
    this.textColor = const Color(0xFF270685),
    this.minSize = 19,
        this.textSize = 10,
        this.zeroShow = false,
  });

  @override
  Widget build(BuildContext context) {
    if (!zeroShow && num == 0) {
      return const SizedBox();
    }
    return ZContainer(
      constraints: BoxConstraints(minWidth: minSize, minHeight: minSize),
      padding: const EdgeInsets.symmetric(horizontal: 3),
      color: color,
      radius: 50,
      alignment: Alignment.center,
      child: (num > max ? '$max+' : '$num').text(color: textColor, size: textSize, bold: true),
    );
  }
}
